#include "http.h"
class HttpServer hs;

std::string login(std::string path) // class HttpServer的友元函数
{
    FILE *fd = fopen("account", "r");
    std::string username;
    std::string userpd;

    auto v = hs.GetUsernamepd();
    username = v[0];
    userpd = v[1];
    // 对比账户文件   账号 || 密码错误 发送账号、密码错误的网页

    // 添加"="前缀
    username = "username=" + username;
    userpd = "userpd=" + userpd;
    hs.AddKeyValue("Set-Cookie", username.c_str());
    hs.AddKeyValue("Set-Cookie", userpd.c_str());
    return "";
}

int main()
{
    hs.InsertServer("/mushu.html", login);
    hs.Start();
    return 0;
}
